<%@page import="java.util.ArrayList"%>
<%@page import="test.Topic"%>
<%@page import="java.util.List"%>
<%@page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8">
<title>TEST BLOG</title>
</head>
<body>
<h1>TEST BLOG</h1>

<%-- 登録用フォーム --%>

<html:form action="/read.do">
<html:text size="50"  property="title"></html:text>
<br></br>
<html:textarea property="message" cols="50"></html:textarea>
<html:submit property="submit" value="投稿"></html:submit>
</html:form>
<%-- エラーの表示 --%>
<H2>
<html:errors />
</H2>
<br></br><br></br><br></br>

<%-- ループ処理で記事を表示 --%>
<%--
<bean:parameter id="List" name="listTopic" />

<logic:iterater id="List"  collection="<%=List %>" indexId="i">
	<bean:write name="i" />
</logic:iterater>
 --%>


<%
 List<Topic> listTopic = (List<Topic>)request.getAttribute("listTopic");
 int i = 0;
 Topic topic = null;
 if (listTopic != null) {
	 for ( i = 0 ; i < listTopic.size(); i++) {
	 	topic = (Topic) listTopic.get(i);
%>
			<table border=1 width=50% align=center>
			<tr align="right"><th><%= topic.getTime() %></th></tr>
			<tr align="center"><th><%= topic.getTitle() %></th></tr>
			<tr align="left"><th><%= topic.getMessage() %></th></tr>
			<tr align="right"><th><%= topic.getUser() %></th></tr>
			</table>
			<br></br>
<%
	 }
 }
%>



</body>
</html:html>